<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">


    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            事故关联
        </h1>

        <ol class="breadcrumb">
            <li><a href="/dashboard"><i class="fa fa-dashboard"></i> Home</a></li>
            <li class="active">事故定点</li>
        </ol>
    </section>


    <!-- Main content -->
    <section class="content">

        <div class="row">
            <div class="col-xs-3">
                <div class="input-group input-group-sm">
                    <input type="text" id="input_accident_number" class="form-control" placeholder="事故单号">
                    <span class="input-group-btn">
                      <button type="button" id="btn_query_accident" class="btn btn-info btn-flat">搜索</button>
                    </span>
                </div>
            </div>
        </div>

        <?php if (isset($search_result)): ?>
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-body table-responsive no-padding">
                            <table class="table table-hover">
                                <tr>
                                    <th>定位事故单号</th>
                                    <th>关联事故单号</th>
                                    <th>定位时间</th>
                                    <th>中队</th>
                                    <th>定位人员</th>
                                    <th>操作</th>
                                </tr>

                                <?php foreach ($search_result as $record): ?>
                                    <tr>
                                        <td><?= $record["related_info"] ?></td>
                                        <td><?= $record["adjust_related_info"] ?></td>
                                        <td><?= $record["ts"] ?></td>
                                        <td><?= $record["department"] ?></td>
                                        <td><?= $record["name"] ?></td>
                                        <td>

                                            <?php if (empty($record["adjust_related_info"])): ?>
                                                <a href="#" class="btn  btn-xs btn-primary" data-toggle="modal"
                                                   data-target="#modal_adjust_related"
                                                   data-id="<?= $record['related_info'] ?>"><i
                                                            class="fa  fa-chain "></i> 关联事故</a>
                                            <?php else: ?>
                                                <a href="#" class="btn  btn-xs btn-danger btn_adjust_related_remove"
                                                   data-id="<?= $record['related_info'] ?>"><i
                                                            class="fa  fa-chain-broken"></i> 取消关联事故单</a>
                                            <?php endif; ?>
                                        </td>
                                    </tr>
                                <?php endforeach; ?>
                            </table>
                        </div>
                        <!-- /.box-body -->
                    </div>
                    <!-- /.box -->
                </div>
            </div>


            <div class="modal fade" id="modal_adjust_related" tabindex="-1" role="dialog" aria-labelledby="">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                        aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="exampleModalLabel">修改密码</h4>
                        </div>
                        <div class="modal-body">
                            <div class="form-group has-feedback">
                                <label for="input_password" class="control-label">定位事故单号:</label>
                                <input type="text" id="input_related" class="form-control" placeholder="事故单号" disabled>
                            </div>
                            <div class="form-group has-feedback">
                                <label for="input_password" class="control-label">关联单号:</label>
                                <input type="text" id="input_adjust_related" class="form-control" placeholder="事故单号">
                            </div>
                            <p id="modify_passwd_tips" class="label label-danger"></p>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <button type="button" class="btn btn-primary" id="btn_adjust_related">确定关联</button>
                        </div>
                    </div>
                </div>
            </div>
        <?php endif; ?>
    </section>
</div>
<!-- /.content-wrapper -->